<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Thor.Models.CurrentAvailabilityTimeZone>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <img alt="" src="..\..\Content\Logo.jpg" />
    </p>
    <fieldset>
        <legend>current availability</legend>
        <p>
            <strong>time zone:</strong>
            <%= Html.Encode(Model.TimeZone.ToLower()) %>
        </p>
        <p>
            <strong>date:</strong>
            <%= Html.Encode(Model.Timestamp.ToLower()) %>
        </p>
        <table>
            <tr>
                <td>
                    <strong>resource</strong>
                </td>
                <td>
                    <strong>
                        <%= Html.Encode(Model.CurrentTimeslotBegin.ToShortTimeString().ToLower()) %></strong>
                </td>
                <td>
                    <strong>
                        <%= Html.Encode(Model.NextTimeslotBegin.ToShortTimeString().ToLower()) %></strong>
                </td>
            </tr>
            <% foreach (var entry in Model.Entries)
               {
                   RouteValueDictionary rvdCalendarIndex = new RouteValueDictionary();
                   rvdCalendarIndex.Add("id", entry.CalendarEmail);

                   RouteValueDictionary rvdCurrentTimeslot = entry.CurrentTimeslot.GetRouteValueDictionary();
                   RouteValueDictionary rvdNextTimeslot = entry.NextTimeslot.GetRouteValueDictionary();
                   %>
            <tr>
                <% if (entry.IsSelected)
                   {
                       %>
                <td class="currentCalendarEntry">
                    <%= Html.ActionLink(entry.CalendarEmail.ToLower(), "Index", "Calendar", rvdCalendarIndex, null) %>
                </td>
                <% }
                   else
                   { %>
                <td>
                    <%= Html.ActionLink(entry.CalendarEmail.ToLower(), "Index", "Calendar", rvdCalendarIndex, null) %>
                </td>
                <% } %>
                <% if (entry.CurrentTimeslot.Available)
                   {
                       if (entry.CurrentTimeslot.OffHours)
                       { %>
                <td class="offHoursCalendarEntry">
                    <%= Html.ActionLink(entry.CurrentTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdCurrentTimeslot, null) %>
                </td>
                <%}
                       else
                       { %>
                <td class="availableCalendarEntry">
                    <%= Html.ActionLink(entry.CurrentTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdCurrentTimeslot, null) %>
                </td>
                <%}
                %>
                <% }
                   else
                   { %>
                <td class="busyCalendarEntry">
                    <%= Html.ActionLink(entry.CurrentTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdCurrentTimeslot, null) %>
                </td>
                >
                <% } %>
                <% if (entry.NextTimeslot.Available)
                   {
                       if (entry.NextTimeslot.OffHours)
                       { %>
                <td class="offHoursCalendarEntry">
                    <%= Html.ActionLink(entry.NextTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdNextTimeslot, null) %>
                </td>
                <%}
                       else
                       { %>
                <td class="availableCalendarEntry">
                    <%= Html.ActionLink(entry.NextTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdNextTimeslot, null) %>
                </td>
                <%}
                %>
                <% }
                   else
                   { %>
                <td class="busyCalendarEntry">
                    <%= Html.ActionLink(entry.NextTimeslot.DisplayText.ToLower(), "Book", "Calendar", rvdNextTimeslot, null) %>
                </td>
                >
                <% } %>
            </tr>
            <% } %>
        </table>
    </fieldset>
</asp:Content>
